<template>
  <div>
    <el-input-number v-model="range.min" placeholder="请输入最小值" controls-position="right" ></el-input-number>
    <span style="margin-left: 10px; margin-right:10px;">~</span>
    <el-input-number v-model="range.max" placeholder="请输入最大值" controls-position="right" ></el-input-number>
  </div>
</template>

<script>
export default {
  name: 'NumberBetween',
  props: {
    value: {
      type: Array,
      default: () => [null, null]
    }
  },
  data() {
    return {
      range: {
        min: this.value[0],
        max: this.value[1]
      }
    };
  },
  watch: {
    range: {
      handler(newValue) {
        this.$emit('input', [newValue.min, newValue.max]);
      },
      deep: true
    }
  }
};
</script>
